<?php
include("common.inc.php");
include(INC_PATH."/group.class.php"); //包含團購類
include(INC_PATH."/suppliers.class.php"); //包含團購類
$gp=new GroupClass();

$gp->getone();
unset($cwherestr);
unset($gwherestr);
$todaystart=time();

$gwherestr[]="G.state=1";
$gwherestr[]="G.group_end_time >={$todaystart}";
$gwherestr[]="G.group_begin_time < {$todaystart}";	
if(!empty($gwherestr)) $gwheresql = implode(' AND ', $gwherestr);	//條件匯總
$max=6;//最多幾則團購
$dataarray=$gp->getdata("0,$max","IMG",$gwheresql,"","G.gid,G.sid,G.title,G.shop_price,G.market_price,A.filepath"); //獲取團購數據
//var_dump($dataarray);
foreach ($dataarray as $k => $v) {
	$v['min_title'] = mb_strimwidth($v['title'],0,25,"...","UTF-8");
	$dataarray[$k]["min_title"] =  $v['min_title'] ;
	$v['title'] = mb_strimwidth($v['title'],0,85,"...","UTF-8");
	$dataarray[$k]["title"] =  $v['title'] ;	 
}

include template('mycoupon');//包含輸出指定模板
?>